Skip to content

ssl.c: Move code out and some fixes#10926

Merged
philljj merged 1 commit into
wolfSSL:masterfrom
SparkiDev:extract_funcs_ssl_2
Jul 22, 2026
Merged

ssl.c: Move code out and some fixes#10926
philljj merged 1 commit into
wolfSSL:masterfrom
SparkiDev:extract_funcs_ssl_2

Conversation

@SparkiDev

Copy link
Copy Markdown
Contributor

Description

ssl_api_hs.c: Handhshake code
ssl_api_rw.c: Reading and writing
ssl_err.c: wolfSSL_ERR API
ssl_asn1.c: Moved wolfSSL_OBJ API in. Move nid2oid/oid2nid in. ssl_crypt.c: Moved in wolfSSL_RAND API.
ssl_api_cert.c, ssl_api_pk.c, ssl_api_dtls.c, ssl_api_crl_osp.c:
Added more functions that were clearly in those areas.

Fixed nid2oid/oid2nid to use wolfssl_object_info[]. wolfssl_object_info has calculated start and ends of groups for faster lookup. Re-ordered the list within groups for faster lookup. Removed duplicate OID row - WC_NID_userId, WC_NID_userId. Added entries that were only in nid2oidi/oid2nid:

  • ED25510, Ed448, CSR entries

AddSession was declared before HAVE_GLOBAL_RNG was defined - moved global RNG code.

Testing

Regression tested OpenSSL API

@SparkiDev SparkiDev self-assigned this Jul 16, 2026
@SparkiDev
SparkiDev force-pushed the extract_funcs_ssl_2 branch from 27ab328 to 49f9adb Compare July 16, 2026 06:25
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata +80 B, .text -2,752 B (-0.3%, 769,212 B / 1,048,576 B, total: 73% used)
  • RAM: .bss +192 B (+0.1%, 136,936 B / 262,144 B, total: 52% used)

linuxkm-standard

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #10926

Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src

Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/ssl_asn1.c Outdated
Comment thread src/ssl_asn1.c
Comment thread src/ssl_api_crl_ocsp.c
@SparkiDev
SparkiDev force-pushed the extract_funcs_ssl_2 branch from 49f9adb to 0b2e533 Compare July 16, 2026 06:53
Comment thread src/ssl_api_crl_ocsp.c
Comment thread src/ssl_asn1.c
Comment thread src/ssl_asn1.c Outdated

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #10926

Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

@SparkiDev

SparkiDev commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins: retest this please

FIPS-ready FAILED
Aborted x2

@SparkiDev SparkiDev assigned wolfSSL-Bot and unassigned SparkiDev Jul 16, 2026
@SparkiDev
SparkiDev requested a review from wolfSSL-Bot July 16, 2026 12:16
@SparkiDev
SparkiDev force-pushed the extract_funcs_ssl_2 branch from 0b2e533 to a3babcf Compare July 16, 2026 22:42
@SparkiDev SparkiDev assigned SparkiDev and unassigned SparkiDev Jul 16, 2026
@philljj
philljj self-requested a review July 20, 2026 23:30
@SparkiDev
SparkiDev force-pushed the extract_funcs_ssl_2 branch from a3babcf to ad179bc Compare July 21, 2026 01:39
@SparkiDev

Copy link
Copy Markdown
Contributor Author

Jenkins: retest this please

FIPS-ready FAILED

@philljj philljj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass, noticed some little things introduced during the move that could be cleaned up. Otherwise looks good so far.

(The FIPS-ready failure is unrelated and being fixed).

Comment thread src/ssl_api_hs.c
Comment thread src/ssl_api_rw.c
Comment thread src/ssl_err.c Outdated
Comment thread src/ssl_err.c Outdated
Comment thread src/ssl_err.c Outdated
Comment thread src/ssl_err.c Outdated
Comment thread src/ssl_err.c Outdated
@philljj philljj assigned SparkiDev and unassigned wolfSSL-Bot Jul 21, 2026
ssl_api_hs.c: Handhshake code
ssl_api_rw.c: Reading and writing
ssl_err.c: wolfSSL_ERR API
ssl_asn1.c: Moved wolfSSL_OBJ API in. Move nid2oid/oid2nid in.
ssl_crypt.c: Moved in wolfSSL_RAND API.
ssl_api_cert.c, ssl_api_pk.c, ssl_api_dtls.c, ssl_api_crl_osp.c:
  Added more functions that were clearly in those areas.

Fixed nid2oid/oid2nid to use wolfssl_object_info[].
wolfssl_object_info has calculated start and ends of groups for faster lookup.
Re-ordered the list within groups for faster lookup.
Removed duplicate OID row - WC_NID_userId, WC_NID_userId.
Added entries that were only in nid2oidi/oid2nid:
  - ED25510, Ed448, CSR entries

AddSession was declared before HAVE_GLOBAL_RNG was defined - moved global RNG
code.
@SparkiDev
SparkiDev force-pushed the extract_funcs_ssl_2 branch from ad179bc to 961ae19 Compare July 22, 2026 07:08
@SparkiDev SparkiDev assigned philljj and unassigned SparkiDev Jul 22, 2026
@philljj
philljj requested review from Copilot and philljj July 22, 2026 15:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the monolithic ssl.c by moving OpenSSL-compat and API surface areas into dedicated compilation units, while also improving OID/NID lookup performance via a reorganized wolfssl_object_info[] table and a precomputed “group slice” index initialized at wolfSSL_Init().

Changes:

  • Split handshake and I/O APIs into ssl_api_hs.c and ssl_api_rw.c, and moved OpenSSL ERR APIs into ssl_err.c.
  • Moved/expanded OpenSSL RAND compatibility into ssl_crypto.c and expanded certificate/OCSP/DTLS-related APIs into their respective ssl_api_*.c files.
  • Reworked OID/NID mapping by centralizing entries in wolfssl_object_info[] and adding a computed group-range index (wolfssl_object_info_slice_init()).

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
wolfssl/internal.h Declares wolfssl_object_info_slice_init() for init-time setup.
src/ssl_err.c Adds OpenSSL ERR-API implementation split out from ssl.c.
src/ssl_crypto.c Adds/moves OpenSSL RAND API compatibility implementation.
src/ssl_asn1.c Adds the consolidated wolfssl_object_info[] table and faster group-scoped OID/NID lookup helpers.
src/ssl_api_rw.c Adds/moves read/write/shutdown/data-path APIs into a dedicated unit.
src/ssl_api_pk.c Adds SRP/OpenSSL-compat key-related APIs into the PK unit.
src/ssl_api_hs.c Adds/moves handshake/connect/accept and related OpenSSL-compat handshake helpers.
src/ssl_api_dtls.c Adds DTLS APIs, including stateless accept flow and callback handling.
src/ssl_api_crl_ocsp.c Adds OpenSSL OCSP URL parsing helper for responder URLs.
src/ssl_api_cert.c Adds certificate callback plumbing and peer/verified chain construction helpers.
src/include.am Ensures the newly split source files are included in distribution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ssl_asn1.c
Comment thread src/ssl_crypto.c
Comment thread src/ssl_crypto.c
Comment thread src/ssl_api_rw.c
Comment thread src/ssl_api_cert.c
Comment thread src/ssl_api_pk.c
@philljj
philljj merged commit 793608e into wolfSSL:master Jul 22, 2026
341 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants